1 /***
2 * TestBrowser
3 *
4 * This is basically a browser for looking at and executing JUnit tests.
5 * It uses the new TestRegistry, and the RegistryBrowser.
6 */
7
8 package junit.quilt.ui;
9
10 import junit.runner.*;
11
12 import junit.quilt.framework.*;
13 import junit.quilt.util.*;
14
15 import java.util.Enumeration;
16
17 import javax.swing.JFrame;
18
19 public class TestBrowser extends JFrame
20 {
21 private RegistryBrowser browser;
22
23 public TestBrowser() {
24 super();
25 browser = new RegistryBrowser( TestRegistry.getInstance(), "test" );
26 getContentPane().add( browser );
27 pack();
28 }
29
30 public static void main(String args[]) {
31 try {
32 TestBrowser b = new TestBrowser();
33 TestCollector ltc = new SimpleTestCollector();
34
35 TestRegistry registry = TestRegistry.getInstance();
36
37 Enumeration tests = ltc.collectTests();
38 while (tests.hasMoreElements()) {
39 String testName = (String) tests.nextElement();
40 System.err.println(testName);
41 String keys[] = new String[1];
42 keys[0] = testName;
43 registry.addTest( keys, null );
44 }
45 b.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
46 b.setVisible( true );
47 } catch (Exception e) {
48 e.printStackTrace();
49 }
50 }
51 }
This page was automatically generated by Maven